package com.qfedu.service.impl;

import com.qfedu.dao.CardsDao;
import com.qfedu.dao.impl.CardsDaoImpl;
import com.qfedu.pojo.Cards;
import com.qfedu.service.CardsService;

import java.util.List;

public class CardsServiceImpl implements CardsService {

    private CardsDao cardsDao = new CardsDaoImpl();

    @Override
    public Cards queryCardsByIdcode(String idcode) {
        Cards cards = cardsDao.queryCardsByIdcode(idcode);
        return cards;
    }

    @Override
    public Cards findCardsByIdcode(String idcode) {
        Cards cardsByIdcode = cardsDao.findCardsByIdcode(idcode);
        return cardsByIdcode;
    }
    @Override
    public void tiedCard(Cards cards) {
        cardsDao.saveCards(cards);
    }

    @Override
    public boolean existsCardnumber(String cardnumber) {
        Cards cards = cardsDao.queryCardsByCardnumber(cardnumber);
        if(cards == null){
            return false;
        }
        return true;
    }

    @Override
    public int updateCards(String money, String cardnumber) {
        return cardsDao.updateCards(money,cardnumber);
    }


    /*----------------------------------------------------------------------*/

    @Override
    public Cards findCardsnumber(String s) {
        return cardsDao.findCardsnumber(s);
    }

    @Override
    public Cards find2(Cards cards) {
        return cardsDao.find2(cards);
    }

    @Override
    public List<Cards> findAllByIdcode(String idcode) {
        return cardsDao.findAllByIdcode(idcode);
    }
}
